package br.com.devteam.sgap.service;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import br.com.devteam.sgap.repository.DAOException;

public abstract class ServiceBasicImpl implements IServiceBasic {

	public <T> T findById(Class<T> entityClass, Serializable id) {
		return getDao().findById(entityClass, id);
	}

	public <T> List<T> findByNamedQuery(String namedQuery) {
		return getDao().findByNamedQuery(namedQuery);
	}

	public <T> List<T> findByNamedQuery(String namedQuery,
			Map<String, Object> namedParams) {
		return getDao().findByNamedQuery(namedQuery, namedParams);
	}

	public <T> void delete(T bean) {
		getDao().delete(bean);
	}

	public <T> void update(T bean) {
		getDao().update(bean);
	}

	public <T> T saveFlushAndClear(T bean) {
		return getDao().saveFlushAndClear(bean);
	}

	public <T> T save(T bean) {
		return getDao().save(bean);
	}

	public <T> List<T> findByQuery(String hql, Map<String, Object> namedParams,
			int maxResults) throws DAOException {
		return getDao().findByQuery(hql, namedParams, maxResults);
	}

	public <T> List<T> findByQuery(String hql, Map<String, Object> namedParams) {
		return getDao().findByQuery(hql, namedParams);
	}

	public <T> List<T> findByNamedQuery(String namedQuery, int maxResults) {
		return getDao().findByNamedQuery(namedQuery, maxResults);
	}

	public <T> List<T> findByNamedQuery(String namedQuery,
			Map<String, Object> namedParams, int maxResults) {
		return getDao().findByNamedQuery(namedQuery, namedParams, maxResults);
	}
}
